import os
import pandas as pd

class DataOperation:
    def __init__(self,path):
        self.data = pd.read_csv(path)

    # TODO 将pd读取出的数据转化为列表字典 [(), (), ()]
    def get_data_to_dict(self):
        # [{}, {}， {}，...]
        return [self.data.loc[i].to_dict() for i in self.data.index.values]

    # TODO 将pd读取出的数据转化为列表  [[], [], []]
    def get_data_to_list(self):
        # [[], [], [], ...]
        return self.data.values.tolist()

if __name__ == '__main__':
    project_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

    # TODO join 专门用来路径拼接
    path = os.path.join(project_path, 'lj_data.csv')

    data = DataOperation(path)
    print(data.get_data_to_list())